import java.util.ArrayList;
import java.util.List;

/**
 * Created by losor on 2017/3/16.
 */
public class _119_PascalsTriangleII {
    public List<Integer> getRow(int rowIndex) {
        List<Integer> out = new ArrayList<>();
        for (int i = 0; i <= rowIndex; i++) {
            for (int j = i-1; j > 0; j--) {
                out.set(j,out.get(j-1)+out.get(j));
            }
            out.add(1);
        }
        return out;
    }
}
